/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.feedback.util;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import info.peigen.hotpot.component.feedback.domain.Feedback;
import info.peigen.hotpot.component.feedback.form.FeedbackManageAddForm;
import info.peigen.hotpot.component.feedback.form.FeedbackManageDeleteForm;
import info.peigen.hotpot.component.feedback.form.FeedbackManageEditForm;
import info.peigen.hotpot.component.feedback.repository.entity.FeedbackEntity;
import info.peigen.hotpot.component.feedback.result.info.FeedbackManageInfo;
import info.peigen.hotpot.component.feedback.service.order.FeedbackCreateOrder;
import info.peigen.hotpot.component.feedback.service.order.FeedbackDeleteOrder;
import info.peigen.hotpot.component.feedback.service.order.FeedbackEditOrder;

/**
 * <b>(FeedbackManageConvertor)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2022/8/7
 */
public class FeedbackManageConvertor {

    public static FeedbackCreateOrder convertOrder(FeedbackManageAddForm form) {
        return BeanUtil.toBean(form, FeedbackCreateOrder.class, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static FeedbackEditOrder convertOrder(FeedbackManageEditForm form) {
        return BeanUtil.toBean(form, FeedbackEditOrder.class, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static FeedbackDeleteOrder convertOrder(FeedbackManageDeleteForm form) {
        return BeanUtil.toBean(form, FeedbackDeleteOrder.class, CopyOptions.create().setIgnoreNullValue(true));
    }

    public static FeedbackManageInfo convertToInfo(Feedback domain) {
        return BeanUtil.copyProperties(domain, FeedbackManageInfo.class);
    }

    public static FeedbackManageInfo convertToInfo(FeedbackEntity entity) {
        return BeanUtil.copyProperties(entity, FeedbackManageInfo.class);
    }
}